#ifndef PROGRAMCONTROL_H
#define PROGRAMCONTROL_H
#include "demonstratewidget.h"
#include "vector"
#include "QHBoxLayout"
#include <fstream>

struct posBase{
   int posNum;
   mat posValue;
};

class ProgramControl:public QWidget{
    Q_OBJECT

public:
    ProgramControl(QWidget* wid = NULL,QVBoxLayout* _lay = NULL):QWidget(wid),lay(_lay){}
    ~ProgramControl();
    void createPos(mat pos);
    void createPos(DemonstrateWidget* wid);
    void deletePos();
    list<mat> getSectionPosList();
    list<mat> getAllPosList();
    int createPosNum();

    bool isPosNumInWids(int num,int* index,DemonstrateWidget* wid);
    void createProgramFile(string path);
    void loadProgramFile(string path);

private:
    QVBoxLayout* lay;
    list<DemonstrateWidget*> pWidList;
    DemonstrateWidget* selectedDemoWid = NULL;

private slots:
    void on_demonstrate_clicked(DemonstrateWidget*);
    void on_demonstrate_num_changed(DemonstrateWidget*,int);
};
#endif // PROGRAMCONTROL_H
